<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/4/13
  Time: 19:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page pageEncoding="UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin.css">
    <script src="${pageContext.request.contextPath}/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/js/pintuer.js"></script>
    <script type=“text/javascript” src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <script type=“text/javascript” src="${pageContext.request.contextPath}/js/json2.js"></script>
</head>
<body>

<div class="panel admin-panel">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>查看详情<fmt:formatDate value="${application.applicationCreateTime}" dateStyle="medium" pattern="yyyy-MM-dd hh:mm:ss" /></strong></div>
    <div class="body-content">
        <table class="table table-hover text-center">
            <tr>
                <th width="120">用户名</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>事由</th>
                <th>创建时间</th>
                <th>下一级审批者</th>
            </tr>
                <tr>
                    <td> ${userSession.userName}</td>
                    <td> <fmt:formatDate value="${application.applicationStartTime}" dateStyle="medium" pattern="yyyy-MM-dd hh:mm:ss" /></td>
                    <td> <fmt:formatDate value="${application.applicationEndTime}" dateStyle="medium" pattern="yyyy-MM-dd hh:mm:ss" /></td>
                    <td>${application.applicationItem}</td>
                    <td><fmt:formatDate value="${application.applicationCreateTime}" dateStyle="medium" pattern="yyyy-MM-dd hh:mm:ss" /></td>
                    <td> ${application.approve.user.userName}</td>
                </tr>

        </table>

        <script type="text/javascript">
            function insertToSelect() {
                // var userId= document.getElementById('userId1').value;
                var userId = $("#userId1").val();
                console.log(userId)
                $.ajax({
                    undefined,
                    data: "userId=" + userId,
                    type: "POST",
                    dataType: 'json',
                    url: "selectNextApprover.do",
                    success: function (data) {
                        var list = data.superUser;
                        $("#select1").empty();
                        for (var i = 0; i < list.length; i++) {
                            //添加子元素
                            var userId = list[i].userId;
                            var userName = list[i].userName;
                            $("#select1").append('<option value=' + userId + '>' + userName + '</option>');
                        }
                        for (var j = 0; j < list.length; j++) {
                            console.log(list[j].userId)
                        }
                    },
                    error: function () {
                        alert("fail");
                    }
                });
            }

            function day() {
                var startDate = $('#startDate').val();
                var endDate = $('#endDate').val();
                var time1 = new Date(startDate).getTime();
                var time2 = new Date(endDate).getTime();
                if (time1 > time2) {
                    $('#days').attr("value", 0);
                } else if (time1 == time2) {
                    $('#days').attr("value", 1);
                } else {
                    var date = parseInt(time2 - time1);
                    var days = Math.floor(date / (24 * 60 * 60 * 1000));
                    $('#days').attr("value", days);
                }
            }
        </script>
    </div>
</div>
</body>
</html>